//
//  NSString+CLUtility.h
//  CLBrowser
//
//  Created by 梁慧聪 on 2017/1/7.
//  Copyright © 2021年 梁慧聪. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSString (CLUtility)

- (BOOL)isValidURL;
- (BOOL)isLocal;
- (BOOL)isHTTPProtocol;
- (NSString *)ellipsizeWithMaxLength:(NSInteger)maxLength;
- (NSDictionary *)getWebViewJSONDicWithPrefix:(NSString *)prefix;

- (NSString*)cl_URLEncodedString;
- (NSString*)cl_URLDecodedString;
- (NSString *)cl_subStringFromRange:(NSRange)stringRange;
/*
 起点下标截取字符串（不包含下标所在）
 [@"abc一二三" fa_substringFromIndex:0]  ====>  @"bc一二三"
 [@"abc一二三" fa_substringFromIndex:6]  ====>  @""
 [@"abc一二三" fa_substringFromIndex:-1]  ====>  @"abc一二三"
 */
- (NSString *)cl_substringFromIndex:(NSInteger)from;
/*
 终点下标截取字符串（包含下标所在）
 [@"abc一二三" fa_substringToIndex:0]  ====>  @"a"
 [@"abc一二三" fa_substringToIndex:1]  ====>  @"ab"
 [@"abc一二三" fa_substringToIndex:6]  ====>  @"abc一二三"
 [@"abc一二三" fa_substringToIndex:7]  ====>  @"abc一二三"
 [@"abc一二三" fa_substringToIndex:5]  ====>  @"abc一二三"
 [@"abc一二三" fa_substringToIndex:-1]  ====>  @""
 */
- (NSString *)cl_substringToIndex:(NSInteger)to;

/// url增加参数
- (NSString *)cl_urlSafeAppendParams:(NSDictionary *)paramDicts;

//获取当前时间戳字符串 10位
+ (NSString *)getTimestampSince1970;
/// 正则搜索相关字符位置
- (NSArray <NSTextCheckingResult*>*)matchesByPattern:(NSString *)pattern;
/// 正则替换字符
- (NSString *)replacingCharacters:(NSString *)pattern withString:(NSString *)template;

- (BOOL)isEmpty;

- (NSString *)removeSEHeadAndTail;

- (NSString *)removeEnterAll;
@end
